package com.bone.order.dao;

import java.util.List;
import java.util.Map;

import com.bone.common.BaseIbatisDAO;
import com.bone.order.po.OrdOrderAmountApply;
import com.bone.page.Page;

public class OrdOrderAmountApplyDAO extends BaseIbatisDAO {

	/**
	 * 取符合查询条件的数据.
	 * @param parameter
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public Page<OrdOrderAmountApply> queryOrderPageByParam(Map<String, Object> para,Page<OrdOrderAmountApply> page){     
		Long totalResultSize = (Long) getSqlMapClientTemplate().queryForObject("ORD_ORDER_AMOUNT_APPLY.queryCountByParam", para);
		page.setTotalResultSize(totalResultSize);				
		para.put("startRows", page.getStartRows());				
		para.put("endRows", page.getEndRows());
		para.put("_order", "apply_time");
		page.setItems(getSqlMapClientTemplate().queryForList("ORD_ORDER_AMOUNT_APPLY.queryPageByParam", para));
		return page;
	}
	
	/**
	 * 根据订单ID取订单的申请金额修改记录.
	 * @param orderId
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public List<OrdOrderAmountApply> queryOrderAmountListByOrderId(Long orderId){     
		 return  (List<OrdOrderAmountApply>)this.getSqlMapClientTemplate().queryForList("ORD_ORDER.queryOrdAmountListByOrderId", orderId);
	}
	
	/**
	 * 根据ID取订单的申请金额信息.
	 * @param orderId
	 * @return
	 */
	public OrdOrderAmountApply queryOrderAmountApplyById(Long orderAmountId){     
		 return (OrdOrderAmountApply)this.getSqlMapClientTemplate().queryForObject("ORD_ORDER.queryOrdAmountApplyById", orderAmountId);
	}
	
	
}
